#include <regx52.h>
#include "key.h"

int Key_read()
{
	unsigned char temp = 0;
	P1 = 0x7f;
	if(P1 == 0x77)temp = 1;
	if(P1 == 0x7b)temp = 2;
	if(P1 == 0x7d)temp = 3;
	if(P1 == 0x7e)temp = 4;
	P1 = 0xbf;
	if(P1 == 0xb7)temp = 5;
	if(P1 == 0xbb)temp = 6;
	if(P1 == 0xbd)temp = 7;
	if(P1 == 0xbe)temp = 8;
	P1 = 0xdf;
	if(P1 == 0xd7)temp = 9;
	if(P1 == 0xdb)temp = 10;
	if(P1 == 0xdd)temp = 11;
	if(P1 == 0xde)temp = 12;
	P1 = 0xef;
	if(P1 == 0xe7)temp = 13;
	if(P1 == 0xeb)temp = 14;
	if(P1 == 0xed)temp = 15;
	if(P1 == 0xee)temp = 16;
	return temp;
}
